package com.qfedu.service;

import com.alibaba.fastjson.JSONObject;
import com.qfedu.dao.SongListDao;
import com.qfedu.entity.SongList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhang
 * @Title: commonValidateAdd
 * @date : 2022/2/22 19:26
 */
@Service
public class SongListServiceImpl implements SongListService{

    @Autowired
    private SongListDao songListDao;
    @Override
    public List<SongList> findAllSongList() {
        return songListDao.findAllSongList();
    }

    @Override
    public int addSongList(SongList songList) {
        return songListDao.addSongList(songList);
    }

    @Override
    public int updateSongList(SongList songList) {
        return songListDao.updateSongList(songList);
    }

    @Override
    public int deleteSongList(SongList songList) {
        return songListDao.deleteSongList(songList);
    }

    @Override
    public JSONObject updateSongListById(SongList songList) {
        int i = songListDao.updateSongListById(songList);
        JSONObject jsonObject = new JSONObject();
        if (i != 0){
            jsonObject.put("code",1);
            jsonObject.put("msg","更改成功");

        }else {
            jsonObject.put("code",0);
            jsonObject.put("msg","更改成功");
        }
        return jsonObject;
    }


}
